<!--conf
<sample in_favorites="true">
              <product version="1.6" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               <sampledescription><![CDATA[Try to find necessary data in treegrid using built-in filters and searc capabilities]]></sampledescription></sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Search and Filtering in TreeGrid</title>
	<link rel="STYLESHEET" type="text/css" href="../../../dhtmlxGrid/codebase/dhtmlxgrid.css">
	<script  src="../../../dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
	<script  src="../../../dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
	<script  src="../../../dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
	<script  src="../../codebase/dhtmlxtreegrid.js"></script>
	<script src="../../../dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js" type="text/javascript"></script>
	<script src="../../codebase/ext/dhtmlxtreegrid_filter.js" type="text/javascript"></script>
	
	<style>
	div.gridbox .xhdr{
		background-color:#E5F2F8;
	}
	div.gridbox table.hdr{
		background-color:#E5F2F8;
	}
	div.gridbox div.ftr td{
		text-align:right;
						
	}
	div.gridbox table.hdr td {
		background-color:#E5F2F8;
	
		font-weight:bold;
	}
	</style>
	
</head>

<body>
<link rel='STYLESHEET' type='text/css' href='../common/style.css'>
<table cellspacing="0" cellpadding="0" class="sample_header" border="0">
	<tr valign="middle">
		<!-- COMPONENT ICON -->
		<td width="40" align="center"><img src="../common/dhtmlxtreegrid_icon.gif" border="0"></td>
		<!-- COMPONENT NAME -->
		<td width="150" align="left" nowrap="true">Sample: dhtmlxTreeGrid</td>
		<!-- SAMPLE TITLE -->
		<td width="0" align="left" nowrap><b>Search and Filtering in TreeGrid</b></td>
		<!-- LINK TO COMPONENT PAGE -->
		<td width="0" align="right"><a href="http://www.dhtmlx.com/docs/products/dhtmlxTreeGrid/index.shtml">dhtmlxTreeGrid main page</a></td>
		<!-- CLOSE BUTTON -->
		<td width="50"><div class="sample_close"><a href="javascript:void(0);" onclick="self.close();"><img src="../common/sample_close.gif" width="14" height="14" border="0" alt="X"></a></div></td>
	</tr>
</table>
	
	
	<p>
   TreeGrid supports filtering. You can set search box, text or select filters for each column.
	</p>
	
	By <select onchange="mygrid.setFiltrationLevel(this.value)"><option value="-1" selected="true">last level<option value="1">second level</select> ( affect filters only )
	<table width="550">
		<tr>
			<td>
				<div id="gridbox" width="100%" height="327px" style="background-color:white;"></div>
			</td>
            
		</tr>
	</table>

<div class='sample_code'><div class="hl-main"><pre><span class="hl-code"> 
</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">gridbox</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">width</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">100%</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">height</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">250px</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">style</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">background-color:white;overflow:hidden</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">div</span><span class="hl-brackets">&gt;</span><span class="hl-code">
</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code"><div class="hl-main"><pre><span class="hl-code"> 
    </span><span class="hl-identifier">mygrid</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">dhtmlXGridObject</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">gridbox</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">setImagePath</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../../dhtmlxGrid/codebase/imgs/icons_books/</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">setHeader</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">Search, Text Filter, Select Filter</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
    
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">attachHeader</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">#text_search,#text_filter,#select_filter</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">
    
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">setInitWidths</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">200,100,*</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">setColAlign</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">left,right,right</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">setColTypes</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">tree,price,ed</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">setColSorting</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">str,int,int</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">init</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">mygrid</span><span class="hl-code">.</span><span class="hl-identifier">loadXML</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">treegrid_sample.xml</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;</span></pre></div></span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span></pre></div></div>

<script>

	mygrid = new dhtmlXGridObject('gridbox');
	mygrid.setImagePath("../../../dhtmlxGrid/codebase/imgs/icons_books/");
	mygrid.setHeader("Search, Text Filter, Select Filter");
	mygrid.attachHeader("#text_search,#text_filter,#select_filter")
	mygrid.setInitWidths("300,120,*")
	mygrid.setColAlign("left,right,right")
	mygrid.setColTypes("tree,price,ed");
	mygrid.setColSorting("str,int,int")
	
 
	mygrid.init();
	
	mygrid.loadXML("treegrid_sample1.xml");
	
	
	
	
	
</script>


<!-- FOOTER -->
<table callspacing="0" cellpadding="0" border="0" class="sample_footer"><tr><td style="padding-left: 8px;">&copy; <a href="http://www.dhtmlx.com">DHTMLX LTD</a>. All rights reserved</td></tr></table>
<!-- FOOTER -->

</body>
</html>

